﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static SimpleTool.SerialTool.SerialControl.CommandSectionModel;

namespace SimpleTool.Server
{
    public class CloudChannelExplain
    {
        public string table = string.Empty;

        public string state = string.Empty;

        public string leave = string.Empty;
    }

    public class MultiCommonInfos
    {
        public string object_name { get; set; } = string.Empty;

        public object[] object_param { get; set; } = [];

        public MultiCommonInfos(string name, params object[] param)
        {
            object_name = name; object_param = param;
        }

        public MultiCommonInfos(int value, params object[] param)
        {
            object_name = value.ToString(); object_param = param;
        }
    }

    /// <summary>
    /// Params: 1. Path ; 2.Name ; 3.Password ; 4.EncryptValue ; 5.EncryptKey ; 6.Way
    /// </summary>
    public class SqliteConnectionConfig
    {
        public string Path { get; set; } = string.Empty;
        public string Name { get; set; } = string.Empty;
        public string Password { get; set; } = string.Empty;
        public string EncryptValue { get; set; } = string.Empty;
        public string EncryptKey { get; set; } = string.Empty;
        public int BusyTimeout { set; get; } = 2000;
        public DatabaseConnectWay Way { get; set; } = DatabaseConnectWay.ReadWriteCreate;
    }

    public sealed class SqliteExceuteResult
    {
        public Dictionary<string, Dictionary<string, List<object>>> Result = [];
        public string? ErrorHint = null;
    }

    public sealed class MvvmMessage
    {
        public enum MvvmType
        {
            Command_EditInfoSend,
            Command_EditInfoGet,
            Product_StepSend,
            Product_StepAddtion,
            Product_ArrestInfoGroupSet,
            Product_ArrestInfoGroupOut,
            Database_ActivityStart,
            Database_MapInfoGroup_Request,
            Database_MapInfoGroup_Acquire,
            Database_MapFilesSend,
        }

        public MvvmType Type;

        public object? MsgBody;

        public bool IsResponse;

        public MvvmMessage(MvvmType type, object? msgBody = null, bool isResponse = false)
        {
            Type = type;
            MsgBody = msgBody;
            IsResponse = isResponse;
        }
    }

    public class ConnectFlag { public bool IsConnected = false; }

    public class ExcelOptions
    {
        public string file;

        public List<string> sheets = [];

        public List<int> indexs = [];

        public bool questionSheet = false;

        public int limit = -1;

        public Action<string, string, double>? HintCallBack;

        public ExcelOptions(string file)
        {
            this.file = file;
        }
    }
}
